win32 theme: Query theme borders when rendering buttons
authorBenjamin Otte <otte@gnome.org>
Mon, 15 Feb 2016 05:50:49 +0000 (06:50 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 17 Feb 2016 03:49:27 +0000 (04:49 +0100)
If someone figures out where the remaining pixel comes from: Tell me!

gtk/theme/win32/gtk-win32-base.css

index 6e00067cfcc00ca3e1b9dffc554928a7dac83fc8..ae68ea1857af4743e1877f262458f8d5bfe81a04 100644 (file)
@@ -286,33 +286,44 @@ radio:indeterminate:disabled {
 /* Buttons */
 
 button {
-    background-color: transparent;
     background-image: -gtk-win32-theme-part(button, 1, 1);
-    border-width: 0;
-    padding: 3px;
-}
-
-button:disabled {
-    background-image: -gtk-win32-theme-part(button, 1, 4);
+    padding-top: calc(1px + -gtk-win32-part-border-top(button, 1, 1));
+    padding-right: calc(1px + -gtk-win32-part-border-right(button, 1, 1));
+    padding-bottom: calc(1px + -gtk-win32-part-border-bottom(button, 1, 1));
+    padding-left: calc(1px + -gtk-win32-part-border-left(button, 1, 1));
 }
 
-button:focus {
+button.default {
     background-image: -gtk-win32-theme-part(button, 1, 5);
+    padding-top: calc(1px + -gtk-win32-part-border-top(button, 1, 5));
+    padding-right: calc(1px + -gtk-win32-part-border-right(button, 1, 5));
+    padding-bottom: calc(1px + -gtk-win32-part-border-bottom(button, 1, 5));
+    padding-left: calc(1px + -gtk-win32-part-border-left(button, 1, 5));
 }
 
-button:hover, button:hover:focus {
+button:hover {
     background-image: -gtk-win32-theme-part(button, 1, 2);
-    color: @text_color;
+    padding-top: calc(1px + -gtk-win32-part-border-top(button, 1, 2));
+    padding-right: calc(1px + -gtk-win32-part-border-right(button, 1, 2));
+    padding-bottom: calc(1px + -gtk-win32-part-border-bottom(button, 1, 2));
+    padding-left: calc(1px + -gtk-win32-part-border-left(button, 1, 2));
 }
 
-button:active, button:active:focus, button:active:focus:hover {
+button:active, button:checked {
     background-image: -gtk-win32-theme-part(button, 1, 3);
-    color: @text_color;
+    padding-top: calc(1px + -gtk-win32-part-border-top(button, 1, 3));
+    padding-right: calc(1px + -gtk-win32-part-border-right(button, 1, 3));
+    padding-bottom: calc(1px + -gtk-win32-part-border-bottom(button, 1, 3));
+    padding-left: calc(1px + -gtk-win32-part-border-left(button, 1, 3));
 }
 
-/* Override *:selected { ...} style; affects horizontalbuttons */
-button:selected {
-  background-color: transparent;
+/* XXX: Figure out how to handle disabled active togglebuttons */
+button:disabled {
+    background-image: -gtk-win32-theme-part(button, 1, 4);
+    padding-top: calc(1px + -gtk-win32-part-border-top(button, 1, 4));
+    padding-right: calc(1px + -gtk-win32-part-border-right(button, 1, 4));
+    padding-bottom: calc(1px + -gtk-win32-part-border-bottom(button, 1, 4));
+    padding-left: calc(1px + -gtk-win32-part-border-left(button, 1, 4));
 }
 
 /* Scrollbars */